//
//  ISeasonDish.m
//  XRmenu
//
//  Created by yangxh on 11-3-24.
//  Copyright 2011 E0571. All rights reserved.
//

#import "ISeasonDish.h"


@implementation ISeasonDish

@synthesize cookeryOptions;
@synthesize Id;
@synthesize name;
@synthesize seasonDishId;
@synthesize spellCode;

//=========================================================== 
// - (id)init
//
//=========================================================== 
- (id)init
{
	return [self initWithCookeryOptions:nil Id:0 name:nil seasonDishId:nil];
}


//=========================================================== 
// - (id)initWith:
//
//=========================================================== 
- (id)initWithCookeryOptions:(NSString*)aCookeryOptions Id:(NSInteger)anId name:(NSString*)aName seasonDishId:(NSString*)aSeasonDishId 
{
    self = [super init];
    if (self) {
        self.cookeryOptions = aCookeryOptions;
        self.Id = anId;
        self.name = aName;
        self.seasonDishId = aSeasonDishId;
    }
    return self;
}


//=========================================================== 
// + (id)objectWith:
//
//=========================================================== 
+ (id)objectWithCookeryOptions:(NSString*)aCookeryOptions Id:(NSInteger)anId name:(NSString*)aName seasonDishId:(NSString*)aSeasonDishId  
{
    id result = [[[self class] alloc] initWithCookeryOptions:aCookeryOptions Id:anId name:aName seasonDishId:aSeasonDishId];
	
    return [result autorelease];
}

//=========================================================== 
// - (NSArray *)keyPaths
//
//=========================================================== 
- (NSArray *)keyPaths
{
    NSArray *result = [NSArray arrayWithObjects:
					   @"cookeryOptions",
					   @"Id",
					   @"name",
					   @"seasonDishId",
					   @"spellCode",
					   nil];
	
    return result;
}


//=========================================================== 
// - (NSString *)descriptionForKeyPaths
//
//=========================================================== 
- (NSString *)descriptionForKeyPaths 
{
    NSMutableString *desc = [NSMutableString string];
    NSEnumerator *e = [[self keyPaths] objectEnumerator];
    NSString *thisKey;
    [desc appendString:@"\n\n"];
	
    while ((thisKey = [e nextObject])) {
        [desc appendFormat: @"%@: %@\n", thisKey, [self valueForKey:thisKey]];
    }
	
    return [NSString stringWithString:desc];
}

- (NSString *)description
{
	return [self descriptionForKeyPaths];
}

//=========================================================== 
// dealloc
//=========================================================== 
- (void)dealloc
{
    [cookeryOptions release];
    cookeryOptions = nil;
    [name release];
    name = nil;
    [seasonDishId release];
    seasonDishId = nil;
	[spellCode release];
	spellCode = nil;
	
    [super dealloc];
}

+ (ISeasonDish *)iSeasonDishByParse:(NSDictionary *)info
{
	ISeasonDish *season = [ISeasonDish objectWithCookeryOptions:dictObject(info,@"CookeryOptions")
															 Id:dictInt(info,@"ID")
														   name:dictObject(info,@"Name")
												   seasonDishId:dictObject(info,@"SeasonDishId")];
	season.spellCode = dictObject(info,@"SpellCode");
	return season;
}

@end
